package com.otojob.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.otojob.dto.PageDto;
import com.otojob.entity.Job;
import com.baomidou.mybatisplus.extension.service.IService;
import com.otojob.entity.vo.ReleaseJob;
import com.otojob.utils.Results;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author TingFeng
 * @since 2022-03-18
 */
@CacheConfig(cacheNames = "JobService")
public interface JobService extends IService<Job> {

    /**
     * 投递简历
     * @param jobId
     * @return
     */
    Results sendResume(Integer jobId);

    /**
     * 查找所有招聘信息分页
     * @param pageDto
     * @return
     */
    @Cacheable(key = "",value = "findAllJobList")
    Results findAllJobList(PageDto pageDto);
    /**
     * 模糊查询带分页
     * @param pageDto
     * @return
     */
    @Cacheable(key = "#pageDto.pageNum+#condition",value = "searchByConditions")
    Results searchByConditions(PageDto pageDto,String condition);

    /**
     * 查找职位详情
     * @param id
     * @return
     */
    Results findJobDetails(Integer id);



    /**
     * 发布职业
     * @param releaseJob

     * @return
     */
    @CacheEvict(key = "#userId",value = "releasedJob")
    Results releaseJob(ReleaseJob releaseJob,int userId);

    /**
     * 删除已发布职位
     * @param id
     * @return
     */
    @CacheEvict(key = "#userId",value = "releasedJob")
    Results deleteJobById(Integer id,int userId);

    /**
     * 查询已发布职位
     * @return
     */
    @Cacheable(key = "#userId",value = "releasedJob")
    Results findReleasedJob(int userId);



}
